package com.starlink.model.util;

import com.starlink.model.dtomapper.ShoppingCartOrderDtoMapper;
import com.starlink.model.domain.ShoppingCartOrderDO;
import com.starlink.model.vo.ShoppingCartOrderVO;
import com.google.common.collect.Lists;
import org.apache.commons.collections4.CollectionUtils;

import java.util.ArrayList;
import java.util.List;

/**
 * @author zhanghong
 */
public class ShoppingCartOrderConvert {

    public static List<ShoppingCartOrderVO> buildShoppingCartOrderVoList(List<ShoppingCartOrderDO> shoppingCartOrderDOList) {
        if (CollectionUtils.isEmpty(shoppingCartOrderDOList)) {
            return Lists.newArrayList();
        }
        List<ShoppingCartOrderVO> shoppingCartOrderVOList = new ArrayList<>();
        for (ShoppingCartOrderDO shoppingCartOrderDO : shoppingCartOrderDOList) {
            shoppingCartOrderVOList.add(ShoppingCartOrderDtoMapper.INSTANCE.do2VO(shoppingCartOrderDO));
        }

        return shoppingCartOrderVOList;
    }
}
